package com.myself.model.demo;

import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.time.LocalDateTime;

/**
 * @author Czx
 */
@Slf4j
@SpringBootApplication
@EnableDiscoveryClient
public class ModelDemoApplication {

    public static void main(String[] args) {
        String startApplicationStr = "\n项目已启动\n项目名称:{}\n启动时间:{}";
        ConfigurableApplicationContext context = SpringApplication.run(ModelDemoApplication.class, args);
        Environment environment = context.getBean(Environment.class);
        log.info(StrUtil.format(startApplicationStr,environment.getProperty("spring.application.name"), LocalDateTime.now()));
    }

}
